<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="../includes/common.jsp" %>

<form action="${scriptPath}" id="form_edit">
	<input type="hidden" name="action" value="exam.create" />
	
	<p><label>Tên: 
		<input type="text" name="ec_name" value="${param.ec_name}" style="width:200px;margin-right:100px;"></input></input></label> 
		<c:if test="${!(empty nameErr)}">
			<span style="">${nameErr}</span>
		</c:if>
	</p>
	<br />
	<p><label>Lớp: 
		<input type="text" name="ec_class" value="${param.ec_class}" style="width:200px;margin-right:100px;"></input></label> 
		<c:if test="${!(empty classErr)}">
			<span style="">${classErr}</span>
		</c:if>
	</p>
	<br />
	<p><label>Đề thi:
	   <input type="text" name="ec_testname" value="${param.ec_testname}" id="txtTest" style="width:200px;margin-right:100px;"></input>
	   <input type="hidden" name="ec_testid" value="${param.ec_testid}" id="valTest" ></input>
	</label>
	</p>
	<br />
	<p>
		<button type="submit" name="ec_submit" value="create">Tạo</button>
        <button type="button" onclick="location.href='${scriptPath}?action=exam.list'">Quay về danh sách</button>
	</p>
</form>

<script type="text/javascript">
  new Autocomplete('txtTest', { 
	  serviceUrl:'${scriptPath}?action=test.ajaxsearch',    
	  minChars:2, 
	  maxHeight:400,
	  width:300,
	  deferRequestBy:100,
	  // callback function:
	  onSelect: function(value, data){
		  $('valTest').value = data;
	  }
    });
</script>